package com.yc.forum.servlet;

import com.yc.forum.dao.RedisDao;
import com.yc.forum.util.Utils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//    通过帖子主键id的字符串查询帖子的likesum  commentsum collectsum
@WebServlet(name = "RedisPostindexServlet", value = "/RedisPostindex.s")
public class RedisPostindexServlet extends HttpServlet {
    private RedisDao redisDao =new RedisDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id=request.getParameter("id");
        List<Map<String,Object>> list= redisDao.selectPost(id);
        System.out.println("-----------------------------------------------------------------------");
        System.out.println("list="+list.toString());
        Utils.toJson(list,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
